package com.edu.imau.TParking;

import com.edu.imau.FixedParking.Fixed;
import com.edu.imau.ParkingDao;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/TemporaryUpdate")
public class TUpdateServlet extends HttpServlet {
    private ParkingDao dao =new ParkingDao();
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //1：接收请求 处理参数
        String t_id = request.getParameter("t_id");
        //2:调用model
        System.out.println(t_id);
        if(t_id != null){
            Temporary temporary = dao.getTemporaryById(Integer.parseInt(t_id));
            //3:展示view
            request.setAttribute("temporary",temporary);
            request.getRequestDispatcher("Temporary.jsp").forward(request,response);
        }
    }
}
